package hutool.demo01;

import cn.hutool.json.JSONUtil;

import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class Demo01 {
    public static void main(String[] args) {
        for (int i = 0; i < 20; i++) {
            if (i==11){
                System.out.println("11111");
            }
            System.out.println(i);
        }
    }

    public static void demo02() {
        String jsonString = "[{\"title\":\"驾驶员姓名\",\"field\":\"driverName\"},{\"title\":\"派车单号\",\"field\":\"orderCarNo\"},{\"title\":\"拒接操作时间\",\"field\":\"dealTime\"},{\"title\":\"拒接原因\",\"field\":\"remark\"}]";
        List<Map> list = JSONUtil.toList(JSONUtil.parseArray(jsonString), Map.class);
        String[] fields = new String[list.size()];
        String[] titles = new String[list.size()];
        // Map<String, String> resultMap = new HashMap<>();
        for (int i = 0; i < list.size(); i++) {
            // fields[i] = list.get(i).get("field").toString();
            // titles[i] = list.get(i).get("title").toString();
            fields[i] = list.get(i).get("field").toString();
            titles[i] = list.get(i).get("title").toString();
        }
        // System.out.println(fields[0]);
        // System.out.println(titles[0]);
        // list.forEach(item->resultMap.put(item.get("title").toString(),item.get("field").toString()));
        // System.out.println(resultMap);
        System.out.println(Arrays.toString(fields));
        System.out.println(Arrays.toString(titles));
    }

    public static void demo01() {
        String month = "02";
        int i = Integer.parseInt(month);
        // String format = String.format("%s-%2d-%2d", "2004", 2, 2);
        int lastDay = LocalDate.of(2024, 2, 1).with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
        System.out.println(lastDay);
    }
}
